import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
export default new Vuex.Store({
  strict: true,
  state: {
    token: '',
    city: '杭州',
    cityId: ''
  },
  mutations: {
    setToken (state, token) {
      state.token = token
    },
    setCity (state, val) {
      state.city = val.label
      state.cityId = val.value
    }
  },
  plugins: [createPersistedState()]
})
